﻿using System.Collections.Generic;

namespace System.Collections.Concurrent
{
	internal sealed class ConcurrentQueue<T> : Queue<T>
	{
		private readonly object gate = new object();

		public new void Enqueue(T item)
		{
			lock (gate)
			{
				base.Enqueue(item);
			}
		}

		public bool TryDequeue(out T item)
		{
			lock (gate)
			{
				item = Dequeue();
				return true;
			}
		}
	}
}